package lab02.test23;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * Created by asus on 2017/11/2.
 */
public class Test {
    public static void main(String[] args) throws ParseException {

        //19981101
        String birthday;
        Scanner scanner=new Scanner(System.in);

        //1998-11-01
        System.out.println("Please input your birthday");
        birthday=scanner.nextLine();

        System.out.println(birthday);

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-mm-dd");
        //关于日期的计算 Calendar
        Calendar calendar=Calendar.getInstance();

        calendar.setTime(sdf.parse(birthday));
        long time1=calendar.getTimeInMillis();

        calendar.setTime(sdf.parse("2017-11-02"));
        long time2=calendar.getTimeInMillis();

        System.out.println("天数："+(time2-time1)/(24*60*60*1000));
        /**
         * time1 生日
         * time2 当前日期
         * 1秒=1000毫秒
         *
         * (time1-time2)/(24*60*60*1000)天数
         */
        //计算你的生日还有多少天
        //生日12-01

        //你的生日是星期几

    }
}
